package com.fourth_groups.shopping121store.ui.person.view;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Window;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.fourth_groups.shopping121store.R;

public class Gradpay extends AppCompatActivity {

    private WebView wv_pay;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_gradpay);
        wv_pay = (WebView) findViewById(R.id.persentpay_webView);
        Intent intent=getIntent();
        String url = intent.getStringExtra("url");
        wv_pay.loadUrl(url);
        wv_pay.getSettings().setJavaScriptEnabled(true);
        wv_pay.setWebViewClient(new WebViewClient(){
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                wv_pay.loadUrl(url);
                return true;
            }
        });
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if ((keyCode == KeyEvent.KEYCODE_BACK) && wv_pay.canGoBack()) {
            wv_pay.goBack();
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }
}
